﻿using App;
using Domin;
using Microsoft.AspNetCore.Hosting;
using System.IO;
using Microsoft.EntityFrameworkCore;
using JwT;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace UL.Controllers
{
    /// <summary>
    /// 用户登录
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LoginsController : ControllerBase
    {
        private readonly IRApp db;

        /// <summary>
        /// 依赖注入
        /// </summary>
        /// <param name="db"></param>
        public LoginsController(IRApp db)
        {
            this.db = db;
        }
        /// <summary>
        /// 登录
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public IActionResult Login(UserLoginDto user)
        {
            ResponseModel result = db.Login(user);
            return Ok(result);
        }
    }
}
